<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<script>
    //reverse()翻转数组
    var arr = [1,2,5,3,4];
    arr.reverse();
    console.log(arr);

    //数组排序  冒泡排序
    var arr1 = [13,4,77,1,7];
    arr1.sort(function(a,b){
        return b-a; //a-b升序排列   b-a 降序排序
    });
    console.log(arr1);
    
    for(var i = 0;i<arr.length;i++){
        for(var j = 0;j<=i;j++){
            if(arr[j] <arr[j+1]){
                var temp = 0 ;
                temp = arr[j];
                arr[j] = arr[j+1];
                arr[j+1] = temp
            }
        }
    }console.log(arr);


</script>
<body>
    
</body>
</html>